from flask import Flask, jsonify

# 1.终端上输入:flask routes
# 2.app.url_map，flask的所有路由都存放在app.url_map
# print(app.url_map)
# 3.自定义一个路由接口返回,所有路由数据
app = Flask(__name__)
@app.route('/')
def index():
    data = {}
    for rule in app.url_map.iter_rules():
        data[rule.endpoint] = rule.rule
    return jsonify(data)

@app.route('/index')
def inedx2():
    return 'index2'

if __name__ == '__main__':
    app.run(debug=True)